package com.micookie.v2ex.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by Administrator on 2016-11-12.
 * 主题回复实体
 */


public class Reply implements Parcelable {


    private String content;
    private String createdFormat;
    private int floorNum;
    private int thanks;
    private Member member;

    public Reply() {
    }


    public String getCreatedFormat() {
        return createdFormat;
    }

    public void setCreatedFormat(String createdFormat) {
        this.createdFormat = createdFormat;
    }

    public int getFloorNum() {
        return floorNum;
    }

    public String getFloorNumString() {
        return floorNum <= 0 ? "" : String.valueOf(floorNum);

    }

    public void setFloorNum(int floorNum) {
        this.floorNum = floorNum;
    }

    public void setFloorNum(String floorNum) {
        this.floorNum = Integer.parseInt(floorNum.trim().isEmpty() ? "0" : floorNum);
    }

    public int getThanks() {
        return thanks;
    }

    public void setThanks(int thanks) {
        this.thanks = thanks;
    }

    public Member getMember() {
        return member == null ? member = new Member() : member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public static final Creator<Reply> CREATOR = new Creator<Reply>() {
        @Override
        public Reply createFromParcel(Parcel in) {
            return new Reply(in);
        }

        @Override
        public Reply[] newArray(int size) {
            return new Reply[size];
        }
    };

    protected Reply(Parcel in) {
        content = in.readString();
        createdFormat = in.readString();
        floorNum = in.readInt();
        thanks = in.readInt();
        member = in.readParcelable(Member.class.getClassLoader());
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(content);
        parcel.writeString(createdFormat);
        parcel.writeInt(floorNum);
        parcel.writeInt(thanks);
        parcel.writeParcelable(member, i);
    }
}
